package com.noassertions.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

//TODO: implement serializable
/**
 * @author labratmatt
 *
 */
@Entity
public class Fit implements Serializable
{
	@Id
    @GeneratedValue
	private int fitid;
	@Column(nullable=false)
	private int userid;
	@Column(nullable=false)
	private Date dateofmeasurement;
	@Column(nullable=false)
	private float saddleheight;
	@Column(nullable=false)
	private float centertobars;
	@Column(nullable=false)
	private float centertosaddle;
	@Column(nullable=false)
	private float floortobars;
	@Column(nullable=false)
	private float floortosaddle;
	@Column(nullable=false)
	private float barswidth;
	@Column(nullable=true)
	private String notes; 
	
	@OneToMany(mappedBy="fitid", cascade = CascadeType.ALL, fetch=FetchType.EAGER)
	private Set<Comment> comments = new HashSet<Comment>();
	
	@Column(nullable=false)
	private String frame;
	@Column(nullable=false)
	private String shifters;
	@Column(nullable=false)
	private String saddle;
	@Column(nullable=false)
	private String pedals;
	@Column(nullable=false)
	private String stem;
	@Column(nullable=false)
	private String bars;
	@Column(nullable=false)
	private String post;
	@Column(nullable=false)
	private String cranks;

	@OneToMany(mappedBy="fitid", cascade = CascadeType.ALL, fetch=FetchType.EAGER)
	private Set<Image> images = new HashSet<Image>();

	// Convenience vars
	@Transient
	private String firstname;
	@Transient
	private String lastname;
	
	public int getFitid() {
		return fitid;
	}
	public void setFitid(int fitid) {
		this.fitid = fitid;
	}
	public int getUserid() {
		return userid;
	}
	public void setUserid(int riderid) {
		this.userid = riderid;
	}
	public Date getDateofmeasurement() {
		return dateofmeasurement;
	}
	public void setDateofmeasurement(Date dateofmeasurement) {
		this.dateofmeasurement = dateofmeasurement;
	}
	public float getSaddleheight() {
		return saddleheight;
	}
	public void setSaddleheight(float saddleheight) {
		this.saddleheight = saddleheight;
	}
	public float getCentertobars() {
		return centertobars;
	}
	public void setCentertobars(float centertobars) {
		this.centertobars = centertobars;
	}
	public float getCentertosaddle() {
		return centertosaddle;
	}
	public void setCentertosaddle(float centertosaddle) {
		this.centertosaddle = centertosaddle;
	}
	public float getFloortobars() {
		return floortobars;
	}
	public void setFloortobars(float floortobars) {
		this.floortobars = floortobars;
	}
	public float getFloortosaddle() {
		return floortosaddle;
	}
	public void setFloortosaddle(float floortosaddle) {
		this.floortosaddle = floortosaddle;
	}
	public void setNotes(String notes) {
		this.notes = notes;
	}
	public String getNotes() {
		return notes;
	}
	public void setBarswidth(float barswidth) {
		this.barswidth = barswidth;
	}
	public float getBarswidth() {
		return barswidth;
	}
	public void setImages(Set<Image> images) {
		this.images = images;
	}
	public Set<Image> getImages() {
		return images;
	}
	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}
	public Set<Comment> getComments() {
		return comments;
	}
	public String getFrame() {
		return frame;
	}
	public void setFrame(String frame) {
		this.frame = frame;
	}
	public String getShifters() {
		return shifters;
	}
	public void setShifters(String shifters) {
		this.shifters = shifters;
	}
	public String getSaddle() {
		return saddle;
	}
	public void setSaddle(String saddle) {
		this.saddle = saddle;
	}
	public String getPedals() {
		return pedals;
	}
	public void setPedals(String pedals) {
		this.pedals = pedals;
	}
	public String getStem() {
		return stem;
	}
	public void setStem(String stem) {
		this.stem = stem;
	}
	public String getBars() {
		return bars;
	}
	public void setBars(String bars) {
		this.bars = bars;
	}
	public String getPost() {
		return post;
	}
	public void setPost(String post) {
		this.post = post;
	}
	public String getCranks() {
		return cranks;
	}
	public void setCranks(String cranks) {
		this.cranks = cranks;
	}
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	public String getLastname() {
		return lastname;
	}
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

}